<!--账户监控-->
<template>
  <div class="app-container">

    <el-form ref="qryAccountMonitorRel" :model="queryParams" v-show="showSearch" :rules="rules" label-width="68px">
      <el-row :gutter="12">
        <el-col :span="6">
          <el-form-item label="本方账户" prop="accId">
            <baseCombox url="/trade/account/querySelfAccountCombox.action"
                        clearable
                        valueField="accId"
                        @change="selectUnderly"
                        multiple collapse-tags collapse-tags-tooltip
                        labelField="accName"
                        size="small"
                        :style="{width:'100%'}"
                        placeholder="本方账户" v-model="accId"></baseCombox>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="挂钩标的" prop="underlyerId">
            <underlyer clearable multiple collapse-tags collapse-tags-tooltip
                       :coverUnderlyerList="coverUnderlyerList"
                       ref="underlyerIdRef"
                       size="small"
                       :style="{width:'100%'}"
                       placeholder="挂钩标的" v-model="underlyerId"></underlyer>
          </el-form-item>
        </el-col>
        <el-col :span="4" v-if="false">
          <el-form-item label="价格类型" prop="priceType">
            <DictCombox v-model="queryParams.priceType" dictType="priceType" :style="{width:'100%'}"
                        size="small"></DictCombox>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="交易方向">
            <dictCombox v-model="queryParams.payDirection" dictType="payDirection" clearable :style="{width:'100%'}"
                        size="small"></dictCombox>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="业务品种">
            <el-checkbox-group v-model="queryParams.aTypes" :style="{width:'100%'}">
              <el-checkbox label="0">期权</el-checkbox>
              <el-checkbox label="1">对冲</el-checkbox>
            </el-checkbox-group>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="定价配置" prop="cfgId" label-width="68px">
            <baseCombox url="/pricing/comboBox/queryPriceCfg4Local.action?productType=OtcOption" clearable
                        valueField="cfgId"
                        @defaultSelect="(value) => {queryParams.cfgId = value}"
                        :defaultSelectIndex="'0'"
                        labelField="name"
                        size="small"
                        :style="{width:'100%'}"
                        placeholder="定价配置" v-model="queryParams.cfgId"></baseCombox>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="计算日期" label-width="auto" prop="dealDate" v-if="true">
            <el-date-picker value-format="YYYY-MM-DD" v-model="queryParams.dealDate" :style="{width:'100%'}"
                            type="date"
                            placeholder=""/>
          </el-form-item>
        </el-col>
        <el-col :span="1.5">
          <el-form-item>
            <el-button type="primary" icon="Plus" :loading="loading" size="small" style="margin: 3px 3px"
                       @click="handleQuery"
                       v-hasPermi="['risk:fundmanage:fundmonitor:calc']"
            >计算
            </el-button>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="12">


        <el-col :span="2">
          <el-button v-if="calTime!=null"
                     type="success"
                     style="margin: 3px 3px"
                     plain disabled="true"
                     size="small"
          >{{ calTime }}
          </el-button>
        </el-col>

      </el-row>
    </el-form>
    <el-tabs v-model="activeName" type="card">
      <el-tab-pane label="账户监控" name="fundMonitorTab"   class="el-tabs el-tabs--card el-tabs--top app-container flex-cloumn" >
        <xTable ref="fundmonitorRef"
                class="tableDragger_form"
                refId="fundmonitorRef"
                multiple="false"
                v-loading="loading"
                :data="fundMonitorList"
                border="true" :summary-method="getMonitorSummary" show-summary sum-text="汇总" @row-dblclick="dbClickRow"
                @selection-change="handleSelectionChange">
          <template #columList>
            <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
              <template #default="scope">
                <el-button
                    type="text"
                    icon="View"
                    @click="viewResult(scope.row)"
                    v-hasPermi="['risk:fundmanage:fundmonitor:view']"
                >明细
                </el-button>
              </template>
            </el-table-column>
            <el-table-column label="标的代码" align="center" prop="uuICode" :show-overflow-tooltip="true" width="150"/>
            <el-table-column label="标的名称" align="center" prop="uuIName" :show-overflow-tooltip="true" width="150"/>
            <el-table-column label="标的价格" align="right" prop="calcPrice" :show-overflow-tooltip="true"
                             :formatter="formartEmptyTableP2" width="100"></el-table-column>
            <el-table-column label="浮动盈亏" v-if="false" align="right" prop="pFloat" :show-overflow-tooltip="true"
                             :formatter="formartEmptyTableP2" width="100"></el-table-column>
            <el-table-column label="npv" align="right" prop="npv" :show-overflow-tooltip="true"
                             :formatter="formartEmptyTableP2"
                             width="170"></el-table-column>
            <el-table-column label="delta" align="right" prop="delta" :show-overflow-tooltip="true"
                             :formatter="formartEmptyTableP2" width="170"></el-table-column>
            <el-table-column label="deltacash" align="right" prop="cashDelta" :show-overflow-tooltip="true"
                             :formatter="formartEmptyTableP2" width="170"></el-table-column>
            <el-table-column label="gamma" align="right" prop="gamma" :show-overflow-tooltip="true"
                             :formatter="formartEmptyTableP2" width="170"></el-table-column>
            <el-table-column label="gammacash" align="right" prop="cashGamma" :show-overflow-tooltip="true"
                             :formatter="formartEmptyTableP2" width="170"></el-table-column>
            <el-table-column label="theta" align="right" prop="theta" :show-overflow-tooltip="true"
                             :formatter="formartEmptyTableP2" width="170"></el-table-column>
            <el-table-column label="vega" align="right" prop="vega" :show-overflow-tooltip="true"
                             :formatter="formartEmptyTableP2" width="170"></el-table-column>
            <el-table-column label="rho" align="right" prop="rho" :show-overflow-tooltip="true"
                             :formatter="formartEmptyTableP2"
                             width="170"></el-table-column>
          </template>
        </xTable>
      </el-tab-pane>
      <el-tab-pane :label="errTitle" name="fundMonitorErrTab">
        <xTable ref="fundErrorRef" refId="fundErrorRef" multiple="false" v-loading="loading" :data="fundMonitorErrList"
                border="true">
          <template #columList>
            <el-table-column label="序号" type="index" width="50">
            </el-table-column>
            <el-table-column label="合约编号" align="left" prop="iCode" :show-overflow-tooltip="true" width="220"/>
            <el-table-column label="标的代码" align="center" prop="uICode" :show-overflow-tooltip="true" width="150"/>
            <el-table-column label="标的名称" align="center" prop="uIName" :show-overflow-tooltip="true" width="150"/>
            <el-table-column label="异常信息" align="left" prop="errInfo" :show-overflow-tooltip="true"/>
          </template>
        </xTable>
      </el-tab-pane>
    </el-tabs>
    <!-- 添加或修改参数配置对话框 -->
    <el-dialog :title="title" v-model="open" width="70%" :close-on-click-modal="false" draggable destroy-on-close
               append-to-body>
      <el-row :gutter="10" class="mb8" style="margin-top:5px">
        <el-col :span="1.5">


          <el-button
              type="warning"
              style="margin: 3px 3px"
              icon="Download"
              size="small"
              @click="handleExportAll"
          >全量导出
          </el-button>


        </el-col>
      </el-row>
      <div class="app-container flex-cloumn">
      <xTable ref="fundmonitorViewRef" refId="fundmonitorViewRef" multiple="false" :data="detailPageList"
              :summary-method="summary" show-summary sum-text="汇总" height="400px" class="tableDragger_form" >
        <template #columList>
          <el-table-column label="序号" type="index" width="40">
          </el-table-column>
          <el-table-column align="center" label="产品编号" prop="extTradeId" width="150" />
          <el-table-column align="center" label="合约编号" prop="iCode" width="200" />
          <el-table-column align="center" label="期权类型" prop="productType" width="auto"><template #default="scope"> <dict-tag spVal="*" :options="optionType" :value="scope.row.productType"/></template></el-table-column>
          <el-table-column align="center" label="交易日期" prop="tradeDate" width="auto"></el-table-column>
          <el-table-column :show-overflow-tooltip="true" align="center" label="标的代码" prop="uICode" width="auto"/>
          <el-table-column align="center" label="标的名称" prop="uIName" width="100px"/>
          <el-table-column v-if="false" align="center" label="资产类型" prop="uAType" width="auto"/>
          <el-table-column v-if="false" align="center" label="市场类型" prop="uMType" width="auto"/>
          <el-table-column align="center" label="买卖方向" prop="payDirection" width="auto"> <template #default="scope"> <dict-tag :options="payDirection" :value="scope.row.payDirection"/> </template> </el-table-column>
          <el-table-column align="center" label="涨跌类型" prop="optionType" width="auto"> <template #default="scope"> <dict-tag :options="callPut" :value="scope.row.optionType"/>  </template></el-table-column>
          <el-table-column align="center" label="行权方式" prop="exerciseType" width="auto"><template #default="scope"><dict-tag :options="exerciseType" :value="scope.row.exerciseType"/></template></el-table-column>
          <el-table-column :formatter="formartEmptyTableP2" align="right" label="高行权价(元)" prop="strikePrice" width="100px"/>
          <el-table-column :formatter="formartEmptyTableP2" align="right" label="低行权价(元)" prop="lowStrikePrice" width="100px"/>
          <el-table-column :formatter="formartEmptyTablePercentP2" align="right" label="收益率1(%)" prop="yield1" width="100px"/>
          <el-table-column :formatter="formartEmptyTablePercentP2" align="right" label="收益率2(%)" prop="yield2" width="100px"/>
          <el-table-column :formatter="formartEmptyTablePercentP2" align="right" label="收益率3(%)" prop="yield3" width="100px"/>
          <el-table-column :formatter="formartEmptyTableP2" align="right" label="障碍价1(元)" prop="triggerPrice1" width="100px"/>
          <el-table-column :formatter="formartEmptyTableP2" align="right" label="障碍价2(元)" prop="triggerPrice2" width="100px"/>
          <el-table-column :formatter="(row, column, cellValue)=>{return Boolean(cellValue=='1')?'是':'否'}" align="right" label="期权费年化" prop="frontOptionFeeYear" width="120px"/>
          <el-table-column :formatter="formartEmptyTableP2" align="right" label="期权费率(%)" prop="frontOptionFeeRate" width="100px"/>
          <el-table-column :formatter="formartEmptyTableP2" align="right" label="期权费(元)" prop="frontOptionFee" width="100px"/>
          <el-table-column align="center" label="期权费支付日" prop="frontOptionFeePaydate" width="120px"/>

          <el-table-column :formatter="(row, column, cellValue)=>{return Boolean(cellValue=='1')?'是':'否'}" align="right" label="前端费年化" prop="frontFeeYear" width="120px"/>
          <el-table-column :formatter="formartEmptyTableP2" align="right" label="前端费率(%)" prop="frontFeeRate" width="100px"/>
          <el-table-column :formatter="formartEmptyTableP2" align="right" label="前端费(元)" prop="frontFee" width="100px"/>
          <el-table-column align="center" label="前端费支付日" prop="frontFeePaydate" width="100px"/>
          <el-table-column align="center" label="起始日" prop="issueDate" width="100px"/>
          <el-table-column align="center" label="到期日" prop="maturityDate" width="100px"/>
          <el-table-column align="center" label="到期支付日" prop="paymentDate" width="100px"/>
          <el-table-column :formatter="formartEmptyTableP2" align="right" label="提前终止费用(元)" prop="terminateFee" width="120px"/>
          <el-table-column :formatter="formartEmptyTableP2" align="right" label="期初价格" prop="openingPrice" width="100px"/>
          <el-table-column :formatter="formartEmptyTableP2" align="right" label="名义本金(元)" prop="volume" width="120px"/>
          <el-table-column :formatter="formartEmptyTablePercentP2" align="right" label="参与率1(%)" prop="participationRate1" width="100px"/>
          <el-table-column :formatter="formartEmptyTablePercentP2" align="right" label="参与率2(%)" prop="participationRate2" width="100px"/>
<!--          <el-table-column :formatter="formartEmptyTablePercentP2" align="right" label="固定利率(%)" prop="fixedRate" width="100px"/>-->
          <el-table-column align="center" label="期权状态" prop="duEventStatus" width="auto">
            <template #default="scope">
              <dict-tag :options="durationStatus" :value="scope.row.duEventStatus"/>
            </template>
          </el-table-column>
          <el-table-column align="center" label="交易对手" prop="partyName" width="100px"/>
          <el-table-column align="center" label="本方账户" prop="accName" width="100px"/>
          <el-table-column align="center" label="计算日期" prop="calcDate" width="100">
          </el-table-column>
          <el-table-column :formatter="formartEmptyTableP2" align="right" label="标的行情" prop="calcPrice" width="100">
          </el-table-column>
          <!--        <el-table-column :formatter="formartTablePercentP2" align="right" label="收益率(%)" prop="yield" width="130"/>-->
          <el-table-column :formatter="formartTablePercentP2" align="right" label="已实现收益率(%)" prop="realizedYield"
                           width="130"/>
          <!--        <el-table-column :formatter="formartTablePercentP2" align="right" label="历史盈亏率(%)" prop="hisYield"
                                   width="130"/>-->
          <el-table-column :formatter="formartEmptyTableP2" align="right" label="浮动盈亏(元)" prop="plFloat" width="130"/>
          <el-table-column label="npv" align="right" prop="npv" :show-overflow-tooltip="true"
                           :formatter="formartEmptyTableP2" width="170"></el-table-column>
          <el-table-column label="delta" align="right" prop="delta" :show-overflow-tooltip="true"
                           :formatter="formartEmptyTableP2" width="170"></el-table-column>
          <el-table-column label="deltacash" align="right" prop="cashDelta" :show-overflow-tooltip="true"
                           :formatter="formartEmptyTableP2" width="170"></el-table-column>
          <el-table-column label="gamma" align="right" prop="gamma" :show-overflow-tooltip="true"
                           :formatter="formartEmptyTableP2" width="170"></el-table-column>
          <el-table-column label="gammacash" align="right" prop="cashGamma" :show-overflow-tooltip="true"
                           :formatter="formartEmptyTableP2" width="170"></el-table-column>
          <el-table-column label="theta" align="right" prop="theta" :show-overflow-tooltip="true"
                           :formatter="formartEmptyTableP2" width="170"></el-table-column>
          <el-table-column label="vega" align="right" prop="vega" :show-overflow-tooltip="true"
                           :formatter="formartEmptyTableP2" width="170"></el-table-column>
          <el-table-column label="rho" align="right" prop="rho" :show-overflow-tooltip="true"
                           :formatter="formartEmptyTableP2" width="170"></el-table-column>

        </template>
      </xTable>
      </div>
      <el-row style="margin-buttom:5px ;height:30px">
      <pagination   class="pagination-container"
                    style="margin:20px 0 20px 0"
          v-model:limit="queryParams.pageSize"
          v-model:page="queryParams.pageNum"
          :total="detailTotal"
          @pagination="getPageList"
      />
      </el-row>
    </el-dialog>
  </div>
</template>

<script setup name="Fundmonitor">
import {getFundCalResultList, getUnderlyListByFund} from "@/api/risk/fundmanage/fundmonitor";
import * as ExcelJs from "exceljs";
import { saveAs } from 'file-saver'
const {proxy} = getCurrentInstance();
const calTime = ref(null);
const screenHeight = ref(document.documentElement.clientHeight - 250 + "px");
const fundMonitorList = ref([]);
const detailsList = ref([]);
const detailPageList =ref([]);

const detailTotal=ref(0)
const title = ref("账户监控明细");
const open = ref(false);
const accId = ref([]);
const loading = ref(false);
const showSearch = ref(true);
const ids = ref([]);
const underlyerId = ref([]);
const single = ref(true);
const multiple = ref(true);
let begTime = ref(0);
const coverUnderlyerList = ref([]);
const activeName = ref("fundMonitorTab");
const errTitle = ref('异常信息');
const fundMonitorErrList = ref([]);

let endTime = ref(0);
const {
  boolType,
  callPut,
  M_TYPE,
  A_TYPE,
  CURRENCY,
  optionType,
  priceType,
  exerciseType,
  tradeType,
  optionTypePp,
  optionStatus,
  durationStatus,
  payDirection,
  simpleTradeType,
} = proxy.useDict('boolType','callPut','M_TYPE', 'A_TYPE', 'CURRENCY', 'optionType', 'optionTypePp', 'priceType', 'exerciseType', 'tradeType', 'optionStatus', 'payDirection', 'durationStatus', 'simpleTradeType')
const data = reactive({
  queryParams: {
    accId: undefined,
    underlyerId: undefined,
    dealDate: proxy.getSysDate(),
    priceType: 'DP_CLOSE',
    aTypes: ['0', '1'],
    cfgId: "",
    pageNum: 1,
    pageSize: 20
  },
  rules: {
    accId: [{required: false, trigger: "change"}],
    underlyerId: [{required: false, trigger: "change"}],
    aTypes: [{required: false, trigger: "change"}],
    dealDate: [{required: true, message: "不能为空", trigger: "change"}],
    priceType: [{required: true, message: "不能为空", trigger: "change"}],
    cfgId: [{required: true, message: "不能为空", trigger: "change"}]
  }
});

const {queryParams, rules} = toRefs(data);

/** 查询列表 */
function getList() {
  loading.value = true;
  let param = proxy.lsh.cloneDeep(queryParams.value);
  proxy.lsh.assign(param, {"aTypes": queryParams.value.aTypes.join(",")});
  proxy.lsh.assign(param, {"accIds": JSON.stringify(accId.value)});
  proxy.lsh.assign(param, {"underlyerIds": JSON.stringify(underlyerId.value)});
  let sucessMsg = "";
  let errMsg = "";
  getFundCalResultList(param).then(response => {
    fundMonitorList.value = response.msg.success;
    fundMonitorErrList.value = response.msg.error;
    if (proxy.isNotVoid(fundMonitorList.value) && fundMonitorList.value.length > 0) {
      let suceeLength = 0;
      proxy.lsh.map(fundMonitorList.value, function (m) {
        suceeLength += m.details.length
      });
      sucessMsg = ",成功" + suceeLength + "条！";
    }
    if (proxy.isNotVoid(fundMonitorErrList.value) && fundMonitorErrList.value.length > 0) {
      errTitle.value = "异常信息(" + fundMonitorErrList.value.length + ")";
      errMsg = ",失败" + fundMonitorErrList.value.length + "条！";
    } else {
      errTitle.value = "异常信息(0)";
    }
    loading.value = false;
    endTime = new Date();
    calTime.value = '刷新时间: ' + proxy.getCurrTime('YYYY-mm-dd HH:MM:SS', new Date());
    proxy.$modal.alertSuccess("计算完成!耗时：" + parseInt(endTime - begTime) / 1000 + "秒" + sucessMsg + errMsg);
  });
}

/** 搜索按钮操作 */
function handleQuery() {
  proxy.$refs["qryAccountMonitorRel"].validate(valid => {
    if (valid) {
      begTime = new Date();
      calTime.value = '开始计算:' + proxy.getCurrTime('YYYY-mm-dd HH:MM:SS', new Date());
      getList();
    } else {
      calTime.value = null;
    }
  });
}

/** 多选框选中数据 */
function handleSelectionChange(selection) {
  ids.value = selection.map(item => item);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
}

function dbClickRow(row, column, event) {
  //P013XEQ-1791 组合/账户监控，打开一个数据量较多的明细页后，再点击其他明细时不显示数据
  queryParams.value.pageNum=1;
  queryParams.value.pageSize=20;
  title.value = "账户监控明细(" + row.uuICode + " " + row.uuIName + ")"
  detailsList.value = row.details;
  detailTotal.value=row.details.length;
  getPageList();
  open.value = true;
}

function viewResult(row) {
  queryParams.value.pageNum=1;
  queryParams.value.pageSize=20;
  detailsList.value = row.details;
  detailTotal.value=row.details.length;
  getPageList();
  title.value = "账户监控明细(" + row.uuICode + " " + row.uuIName + ")"
  open.value = true;
}

function summary(param) {
  return proxy.getSummary(param, '汇总', 0, 9, '16,17,19,20,21,23,24,25,26,27,33,34,35,36,37', 2);
}

//合计
function getMonitorSummary(param) {
  return proxy.getSummary(param, '汇总', 0, 3, null, 2)
}

//根据账户加载标的
function selectUnderly(val) {
  if (proxy.isNotVoid(val)) {
    getUnderlyListByFund({'accIds': accId.value.toString()}).then(response => {
      coverUnderlyerList.value = response.msg;
      proxy.$refs['underlyerIdRef'].queryUnderlyersByCoverList({}, response.msg);
      queryParams.value.underlyerId = undefined;
    })
  } else {
    coverUnderlyerList.value = [];
    proxy.$refs['underlyerIdRef'].queryUnderlyersByCoverList({}, []);
    queryParams.value.underlyerId = undefined;
  }
}

/** 导出按钮操作 */
function handleExportAll() {
  excelExport("组合监控");;
}

const excelExport = async () => {
  let columnArray=[
    { header: '序号', key: 'idx', width: 10,align:'center' },
    { header: '产品编号', key: 'extTradeId', width: 32,align:'center' },
    { header: '合约编号', key: 'iCode', width: 40,align:'center' },
    { header: '期权类型', key: 'productType', width: 40,align:'center',fmtType:'dict',dictType:optionType.value},
    { header: '交易日期', key: 'tradeDate', width: 20,align:'center' },
    { header: '标的代码', key: 'uICode', width: 20,align:'center' },
    { header: '标的名称', key: 'uIName', width: 20,align:'center' },
    { header: '买卖方向', key: 'payDirection', width: 20,align:'center',fmtType:'dict',dictType:payDirection.value  },
    { header: '涨跌类型', key: 'optionType', width: 20,align:'center' ,fmtType:'dict',dictType:callPut.value   },
    { header: '行权方式', key: 'exerciseType', width: 20,align:'center',fmtType:'dict',dictType:exerciseType.value  },
    { header: '高行权价(元).', key: 'strikePrice', width: 20,align:'right',fmtType:'money' },
    { header: '低行权价(元).', key: 'lowStrikePrice', width: 20,align:'right',fmtType:'money' },
    { header: '收益率1(%)', key: 'yield1', width: 20,align:'right',fmtType:'percent' },
    { header: '收益率2(%)', key: 'yield2', width: 20,align:'right',fmtType:'percent' },
    { header: '收益率3(%)', key: 'yield3', width: 20,align:'right',fmtType:'percent' },
    { header: '障碍价1(元)', key: 'triggerPrice1', width: 20,align:'right',fmtType:'money' },
    { header: '障碍价2(元)', key: 'triggerPrice2', width: 20,align:'right',fmtType:'money' },
    { header: '期权费年化', key: 'frontOptionFeeYear', width: 20,align:'center' ,fmtType:'dict',dictType:boolType.value},
    { header: '期权费率(%)', key: 'frontOptionFeeRate', width: 20,align:'right',fmtType:'percent' },
    { header: '期权费(元)', key: 'frontOptionFee', width: 20,align:'right',fmtType:'money' },
    { header: '期权费支付日', key: 'frontOptionFeePaydate', width: 20,align:'center'  },
    { header: '前端费年化', key: 'frontFeeYear', width: 20,align:'center' ,fmtType:'dict',dictType:boolType.value },
    { header: '前端费率(%)', key: 'frontFeeRate', width: 20 ,align:'right',fmtType:'percent'},
    { header: '前端费(元)', key: 'frontFee', width: 20,align:'right',fmtType:'money' },
    { header: '前端费支付日', key: 'frontFeePaydate', width: 20,align:'center'  },
    { header: '起始日', key: 'issueDate', width: 20,align:'center'  },
    { header: '到期日', key: 'maturityDate', width: 20,align:'center'  },
    { header: '到期支付日', key: 'paymentDate', width: 20,align:'center'  },
    { header: '提前终止费用(元)', key: 'terminateFee', width: 20,align:'right',fmtType:'money' },
    { header: '期初价格', key: 'openingPrice', width: 20,align:'right',fmtType:'money' },
    { header: '名义本金(元)', key: 'volume', width: 20,align:'right',fmtType:'money' },
    { header: '参与率1(%)', key: 'participationRate1', width: 20,align:'right',fmtType:'percent' },
    { header: '参与率2(%)', key: 'participationRate2', width: 20,align:'right' ,fmtType:'percent'},
    { header: '期权状态', key: 'duEventStatus', width: 20,align:'center',fmtType:'dict',dictType:durationStatus.value  },
    { header: '交易对手', key: 'partyName', width: 20,align:'center' },
    { header: '本方账户', key: 'accName', width: 20,align:'center' },
    { header: '计算日期', key: 'calcDate', width: 20,align:'center' },
    { header: '标的行情', key: 'calcPrice', width: 20,align:'right',fmtType:'money' },
    { header: '已实现收益率(%)', key: 'realizedYield', width: 20 ,align:'right',fmtType:'percent'},
    { header: '浮动盈亏(元)', key: 'plFloat', width: 20,align:'right' ,fmtType:'money'},
    { header: 'npv', key: 'npv', width: 20,align:'right',fmtType:'money' },
    { header: 'delta', key: 'delta', width: 20,align:'right' ,fmtType:'money'},
    { header: 'deltacash', key: 'cashDelta', width: 20,align:'right' ,fmtType:'money'},
    { header: 'gamma', key: 'gamma', width: 20,align:'right',fmtType:'money' },
    { header: 'gammacash', key: 'cashGamma', width: 20,align:'right',fmtType:'money' },
    { header: 'theta', key: 'theta', width: 20,align:'right',fmtType:'money' },
    { header: 'vega', key: 'vega', width: 20,align:'right',fmtType:'money' },
    { header: 'rho', key: 'rho', width: 20,align:'right',fmtType:'money' }
];
  //填充数据
  let expRows=proxy.lsh.cloneDeep(detailsList.value);
  let i=1;
  proxy.lsh.forEach(expRows,obj=>{
    obj.idx=i;//新增序号
    obj.frontFeeRate=obj.frontFeeRate==0?0:obj.frontFeeRate/100,
    obj.frontOptionFeeRate=obj.frontOptionFeeRate==0?0:obj.frontOptionFeeRate/100,
    i++;
  })
  proxy.exportExcel(columnArray,expRows,title.value);
}


onMounted(() => {
  setTimeout(() => {
    loading.value = false;
  }, 300);
  window.onresize = function temp() {
    screenHeight.value = document.documentElement.clientHeight - 250 + "px;";
  };
})
function getPageList(a){
  detailPageList.value=proxy.lsh.slice(detailsList.value,(queryParams.value.pageNum-1)*queryParams.value.pageSize,queryParams.value.pageNum*queryParams.value.pageSize);
}


</script>
<style scoped='scoped'>
.tableDragger_form {
  flex: 1 0 65vh;
}
</style>
